<!DOCTYPE HTML>
<html>
<head>
    {include file="common:meta"}
</head>
<body>

<div class="page-container">
    <div class="float-e-margins">
        <div class="ibox-content">
            <div class="tabs-container">
                <ul class="nav nav-tabs">
                    <li class="active"><a data-toggle="tab" href="#tab-1" aria-expanded="true">管理员列表</a>
                    </li>
                    <li class=""><a data-toggle="tab" href="#tab-2" aria-expanded="false">管理员添加</a>
                    </li>
                </ul>
                <div class="tab-content">
                    <div class="tab-pane active" id="tab-1">
                        <table class="table table-bordered">
                            <thead>
                            <tr>
                                <th>用户ID</th>
                                <th>用户名</th>
                            </tr>
                            </thead>
                            <tbody>
                            {volist name="data" key='key' id="list"}
                            <tr>
                                <td>{$list.u_id|default='无'}</td>
                                <td>{$list.nickname|default='无'}</td>
                            </tr>
                            {/volist}
                            </tbody>
                        </table>
                    </div>



                    <div class="tab-pane" id="tab-2">
                        <div class="ibox-content">
                            <form method="" class="form-horizontal" id="form" action="">
                                <div class="hr-line-dashed"></div>
                                <div class="form-group has-success">
                                    <label class="col-sm-2 control-label">*用户UID</label>
                                    <div class="col-sm-10">
                                        <input type="number" name="u_id" value=""  class="form-control">
                                    </div>
                                </div>
                                <div class="col-sm-10">
                                    <input type="hidden" name="id"  value="{$id}" class="form-control">
                                </div>
                                <div class="hr-line-dashed"></div>
                                <div class="form-group has-success">
                                    <div class="col-sm-4 col-sm-offset-2">
                                        <input class="btn btn-primary" id="btn-submit" type="button" value="提交">
                                    </div>
                                </div>
                            </form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
{include file="common:footer"}

<script>

    //同意修改
    var index = parent.layer.getFrameIndex(window.name);
    $('#btn-submit').click(function(){
        layer.confirm('确定添加管理员？',{
            title:['提示','font-size:18px;font-family:楷体;font-weight:700;'],
            btn: ['确定','取消'] //按钮
        },function(){
            $.ajax({
                type:'get',
                url:'/ChatGroupAdminAdd',
                async:true,
                data:$('#form').serialize(),
                dataType:'json',
                success:function(result){
                    console.log(result);
                    if(result.code == 100){
                        layer.msg(result.msg,{
                            icon:1,
                            time:1000
                        });
                        setTimeout(function () {
                            parent.layer.close(index);// 关闭layer
                        },1500);

                    }
                    else{
                        layer.msg(result.msg,{
                            icon:2,
                            time:1000
                        });
                    }
                },
                error:function(err){
                    layer.msg('服务器开小差了！',{
                        time:1500
                    });
                }
            });
        });
    });
</script>
</body>
</html>